//
//  LXWeiBoTool.m
//  微了个小博
//
//  Created by imera on 15/9/23.
//  Copyright (c) 2015年 imera. All rights reserved.
//

#import "LXWeiBoTool.h"
#import "LXViewController.h"
#import "LXNewFeatureViewController.h"

@implementation LXWeiBoTool

/**
 *  选择根控制器
 */
+ (void)chooseRootViewController
{
    //取出沙盒中上一次运行的版本号
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *lastVersion = [defaults stringForKey:@"lastVersion"];
    
    //获得当前版本号
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
    
    if([lastVersion isEqualToString:currentVersion]){
        [UIApplication sharedApplication].keyWindow.rootViewController = [[LXViewController alloc]init];
    }else{
        [UIApplication sharedApplication].keyWindow.rootViewController = [[LXNewFeatureViewController alloc]init];
        //存储当前版本号
        [defaults setObject:currentVersion forKey:@"lastVersion"];
    }
}

@end
